package com.ruoyi.inspection.service.impl;

import com.ruoyi.inspection.domain.GovernCheckTaskFirm;
import com.ruoyi.inspection.mapper.GovernCheckTaskFirmMapper;
import com.ruoyi.inspection.service.GovernCheckTaskFirmService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 政府下发专项任务企业表(GovernCheckTaskFirm)表服务实现类
 *
 * @author makejava
 * @since 2024-06-18 10:48:34
 */
@Service("governCheckTaskFirmService")
public class GovernCheckTaskFirmServiceImpl implements GovernCheckTaskFirmService {
    @Resource
    private GovernCheckTaskFirmMapper governCheckTaskFirmMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GovernCheckTaskFirm queryById(Long id) {
        return this.governCheckTaskFirmMapper.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param governCheckTaskFirm 筛选条件
     * @return 查询结果
     */
    @Override
    public List<GovernCheckTaskFirm> queryByPage(GovernCheckTaskFirm governCheckTaskFirm) {
        return this.governCheckTaskFirmMapper.queryAllByLimit(governCheckTaskFirm);
    }

    /**
     * 新增数据
     *
     * @param governCheckTaskFirm 实例对象
     * @return 实例对象
     */
    @Override
    public GovernCheckTaskFirm insert(GovernCheckTaskFirm governCheckTaskFirm) {
        this.governCheckTaskFirmMapper.insert(governCheckTaskFirm);
        return governCheckTaskFirm;
    }

    /**
     * 修改数据
     *
     * @param governCheckTaskFirm 实例对象
     * @return 实例对象
     */
    @Override
    public GovernCheckTaskFirm update(GovernCheckTaskFirm governCheckTaskFirm) {
        this.governCheckTaskFirmMapper.update(governCheckTaskFirm);
        return this.queryById(governCheckTaskFirm.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.governCheckTaskFirmMapper.deleteById(id) > 0;
    }
}
